
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Custom Build · RxDB - Documentation</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="plugins.html" />
    
    
    <link rel="prev" href="rx-local-document.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://twitter.com/rxdbjs" target="_blank" class="custom-link">Follow @twitter </a>
        </li>
    
        
        <li>
            <a href="https://gitter.im/pubkey/rxdb" target="_blank" class="custom-link">Chat @gitter </a>
        </li>
    
        
        <li>
            <a href="https://github.com/pubkey/rxdb" target="_blank" class="custom-link">Star @github </a>
        </li>
    
        
        <li>
            <a href="https://www.patreon.com/rxdb/" target="_blank" class="custom-link">Donate @patreon </a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="install.html">
            
                <a href="install.html">
            
                    
                    Install
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="install.html">
            
                <a href="install.html#npm">
            
                    
                    npm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="install.html">
            
                <a href="install.html#import">
            
                    
                    import
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="rx-database.html">
            
                <a href="rx-database.html">
            
                    
                    RxDatabase
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="rx-database.html">
            
                <a href="rx-database.html#creation">
            
                    
                    Creation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="rx-database.html">
            
                <a href="rx-database.html#name">
            
                    
                    name
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="rx-database.html">
            
                <a href="rx-database.html#adapter">
            
                    
                    adapter
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.3" data-path="rx-database.html">
            
                <a href="rx-database.html#password">
            
                    
                    password
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.4" data-path="rx-database.html">
            
                <a href="rx-database.html#multiinstance">
            
                    
                    multiInstance
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.5" data-path="rx-database.html">
            
                <a href="rx-database.html#eventreduce">
            
                    
                    eventReduce
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.6" data-path="rx-database.html">
            
                <a href="rx-database.html#ignoreduplicate">
            
                    
                    ignoreDuplicate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.7" data-path="rx-database.html">
            
                <a href="rx-database.html#pouchSettings">
            
                    
                    pouchSettings
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="rx-database.html">
            
                <a href="rx-database.html#functions">
            
                    
                    Functions
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="rx-database.html">
            
                <a href="rx-database.html#observe-with-">
            
                    
                    $
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="rx-database.html">
            
                <a href="rx-database.html#dump">
            
                    
                    dump()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.3" data-path="rx-database.html">
            
                <a href="rx-database.html#importdump">
            
                    
                    importDump()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.4" data-path="rx-database.html">
            
                <a href="rx-database.html#server">
            
                    
                    server()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.5" data-path="rx-database.html">
            
                <a href="rx-database.html#waitforleadership">
            
                    
                    waitForLeadership()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.6" data-path="rx-database.html">
            
                <a href="rx-database.html#requestidlepromise">
            
                    
                    requestIdlePromise()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.7" data-path="rx-database.html">
            
                <a href="rx-database.html#destroy">
            
                    
                    destroy()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.8" data-path="rx-database.html">
            
                <a href="rx-database.html#remove">
            
                    
                    remove()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.9" data-path="rx-database.html">
            
                <a href="rx-database.html#checkadapter">
            
                    
                    checkAdapter()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.10" data-path="rx-database.html">
            
                <a href="rx-database.html#isrxdatabase">
            
                    
                    isRxDatabase()
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="rx-schema.html">
            
                <a href="rx-schema.html">
            
                    
                    RxSchema
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="rx-schema.html">
            
                <a href="rx-schema.html#example">
            
                    
                    Example
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="rx-schema.html">
            
                <a href="rx-schema.html#create-a-collection-with-the-schema">
            
                    
                    Create a collection with the schema
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="rx-schema.html">
            
                <a href="rx-schema.html#version">
            
                    
                    version
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="rx-schema.html">
            
                <a href="rx-schema.html#keycompression">
            
                    
                    keyCompression
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="rx-schema.html">
            
                <a href="rx-schema.html#indexes">
            
                    
                    indexes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="rx-schema.html">
            
                <a href="rx-schema.html#attachments">
            
                    
                    attachments
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="rx-schema.html">
            
                <a href="rx-schema.html#default">
            
                    
                    default
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="rx-schema.html">
            
                <a href="rx-schema.html#final">
            
                    
                    final
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="rx-schema.html">
            
                <a href="rx-schema.html#encryption">
            
                    
                    encryption
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="rx-collection.html">
            
                <a href="rx-collection.html">
            
                    
                    RxCollection
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="rx-collection.html">
            
                <a href="rx-collection.html#creating-a-collection">
            
                    
                    Creation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="rx-collection.html">
            
                <a href="rx-collection.html#name">
            
                    
                    name
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="rx-collection.html">
            
                <a href="rx-collection.html#schema">
            
                    
                    schema
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.3" data-path="rx-collection.html">
            
                <a href="rx-collection.html#pouchSettings">
            
                    
                    pouchSettings
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.4" data-path="rx-collection.html">
            
                <a href="rx-collection.html#orm-functions">
            
                    
                    ORM-functions
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.5" data-path="rx-collection.html">
            
                <a href="rx-collection.html#Migration">
            
                    
                    Migration
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="rx-collection.html">
            
                <a href="rx-collection.html#functions">
            
                    
                    Functions
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.2.1" data-path="rx-collection.html">
            
                <a href="rx-collection.html#observe-">
            
                    
                    $
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.2" data-path="rx-collection.html">
            
                <a href="rx-collection.html#insert">
            
                    
                    insert()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.3" data-path="rx-collection.html">
            
                <a href="rx-collection.html#newdocument">
            
                    
                    newDocument()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.4" data-path="rx-collection.html">
            
                <a href="rx-collection.html#upsert">
            
                    
                    upsert()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.5" data-path="rx-collection.html">
            
                <a href="rx-collection.html#atomicupsert">
            
                    
                    atomicUpsert()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.6" data-path="rx-collection.html">
            
                <a href="rx-collection.html#find">
            
                    
                    find()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.7" data-path="rx-collection.html">
            
                <a href="rx-collection.html#findone">
            
                    
                    findOne()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.8" data-path="rx-collection.html">
            
                <a href="rx-collection.html#findByIds">
            
                    
                    findByIds()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.9" data-path="rx-collection.html">
            
                <a href="rx-collection.html#dump">
            
                    
                    dump()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.10" data-path="rx-collection.html">
            
                <a href="rx-collection.html#importdump">
            
                    
                    importDump()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.11" data-path="rx-collection.html">
            
                <a href="rx-collection.html#sync">
            
                    
                    sync()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.12" data-path="rx-collection.html">
            
                <a href="rx-collection.html#remove">
            
                    
                    remove()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.13" data-path="rx-collection.html">
            
                <a href="rx-collection.html#destroy">
            
                    
                    destroy()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2.14" data-path="rx-collection.html">
            
                <a href="rx-collection.html#isrxcollection">
            
                    
                    isRxCollection()
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="rx-document.html">
            
                <a href="rx-document.html">
            
                    
                    RxDocument
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="rx-document.html">
            
                <a href="rx-document.html#insert">
            
                    
                    Insert
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="rx-document.html">
            
                <a href="rx-document.html#find">
            
                    
                    Find
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="rx-document.html">
            
                <a href="rx-document.html#functions">
            
                    
                    Functions
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.3.1" data-path="rx-document.html">
            
                <a href="rx-document.html#get">
            
                    
                    get()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.2" data-path="rx-document.html">
            
                <a href="rx-document.html#get$">
            
                    
                    get$()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.3" data-path="rx-document.html">
            
                <a href="rx-document.html#proxy-get">
            
                    
                    proxy-get
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.4" data-path="rx-document.html">
            
                <a href="rx-document.html#update">
            
                    
                    update()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.5" data-path="rx-document.html">
            
                <a href="rx-document.html#atomicupdate">
            
                    
                    atomicUpdate()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.6" data-path="rx-document.html">
            
                <a href="rx-document.html#atomicset">
            
                    
                    atomicSet()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.7" data-path="rx-document.html">
            
                <a href="rx-document.html#observe-">
            
                    
                    $
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.8" data-path="rx-document.html">
            
                <a href="rx-document.html#remove">
            
                    
                    remove()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.9" data-path="rx-document.html">
            
                <a href="rx-document.html#deleted$">
            
                    
                    deleted$
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.10" data-path="rx-document.html">
            
                <a href="rx-document.html#tojson">
            
                    
                    toJSON()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.11" data-path="rx-document.html">
            
                <a href="rx-document.html#set">
            
                    
                    set()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.12" data-path="rx-document.html">
            
                <a href="rx-document.html#save">
            
                    
                    save()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.13" data-path="rx-document.html">
            
                <a href="rx-document.html#isrxdocument">
            
                    
                    isRxDocument()
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="rx-query.html">
            
                <a href="rx-query.html">
            
                    
                    RxQuery
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="rx-query.html">
            
                <a href="rx-query.html#find">
            
                    
                    find()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="rx-query.html">
            
                <a href="rx-query.html#findOne">
            
                    
                    findOne()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="rx-query.html">
            
                <a href="rx-query.html#exec">
            
                    
                    exec()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="rx-query.html">
            
                <a href="rx-query.html#observe-">
            
                    
                    $
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="rx-query.html">
            
                <a href="rx-query.html#update">
            
                    
                    update()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="rx-query.html">
            
                <a href="rx-query.html#remove">
            
                    
                    remove()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="rx-query.html">
            
                <a href="rx-query.html#doesDocumentDataMatch">
            
                    
                    doesDocumentDataMatch()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="rx-query.html">
            
                <a href="rx-query.html#examples">
            
                    
                    Examples
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="rx-query.html">
            
                <a href="rx-query.html#isrxquery">
            
                    
                    isRxQuery()
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="rx-attachment.html">
            
                <a href="rx-attachment.html">
            
                    
                    RxAttachment
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="middleware.html">
            
                <a href="middleware.html">
            
                    
                    Middleware-hooks
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="orm.html">
            
                <a href="orm.html">
            
                    
                    ORM/DRM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="population.html">
            
                <a href="population.html">
            
                    
                    Population
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="data-migration.html">
            
                <a href="data-migration.html">
            
                    
                    DataMigration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="leader-election.html">
            
                <a href="leader-election.html">
            
                    
                    LeaderElection
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="replication.html">
            
                <a href="replication.html">
            
                    
                    Replication CouchDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="replication-graphql.html">
            
                <a href="replication-graphql.html">
            
                    
                    Replication GraphQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="in-memory.html">
            
                <a href="in-memory.html">
            
                    
                    InMemory
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="query-cache.html">
            
                <a href="query-cache.html">
            
                    
                    QueryCache
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="rx-local-document.html">
            
                <a href="rx-local-document.html">
            
                    
                    LocalDocuments
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.19" data-path="custom-build.html">
            
                <a href="custom-build.html">
            
                    
                    Custom Build
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="plugins.html">
            
                <a href="plugins.html">
            
                    
                    Creating Plugins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="adapters.html">
            
                <a href="adapters.html">
            
                    
                    Adapters
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.22" >
            
                <span>
            
                    
                    Tutorials
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.22.1" data-path="tutorials/typescript.html">
            
                <a href="tutorials/typescript.html">
            
                    
                    Use RxDB with Typescript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.22.2" data-path="tutorials/server.html">
            
                <a href="tutorials/server.html">
            
                    
                    Using the Server Plugin
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="questions-answers.html">
            
                <a href="questions-answers.html">
            
                    
                    Questions & Answers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24" data-path="contribute.html">
            
                <a href="contribute.html">
            
                    
                    Contribute
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Custom Build</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="custom-build">Custom Build</h1>
<p>By default, if you import RxDB into your javascript, a full batteries-included build will be imported. This has the advantage that you don&apos;t have to choose which things you need and which not. The disadvantage is the build-size. Often you don&apos;t need most of the functionality and you could save a lot of bandwidth by cherry-picking only the things you really need. For this, RxDB supports custom builds.</p>
<h2 id="core">Core</h2>
<p>The core-module is the part of RxDB which is always needed to provide basic functionality. If you need a custom build, you start with the core and then add all modules that you need.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> {
    createRxDatabase,
    addRxPlugin
    <span class="hljs-comment">/* ... */</span>
} <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/core&apos;</span>;
</code></pre>
<h2 id="required-modules">required modules</h2>
<p>Some parts of RxDB are not in the core, but are required. This means they must always be overwrite by at least one plugin.</p>
<h3 id="validate">validate</h3>
<p>The validation-module does the schema-validation when you insert or update a <code>RxDocument</code>. To use RxDB you always have to add a validation-module.
This one is using <a href="https://www.npmjs.com/package/is-my-json-valid" target="_blank">is-my-json-valid</a> but you can also use your own validator instead. To import the default validation-module, do this:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBValidatePlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/validate&apos;</span>;
addRxPlugin(RxDBValidatePlugin);
</code></pre>
<h3 id="ajv-validate">ajv-validate</h3>
<p>Another validation-module that does the schema-validation. This one is using <a href="https://github.com/epoberezkin/ajv" target="_blank">ajv</a> as validator which is a bit faster. Better compliant to the jsonschema-standart but also has a bigger build-size.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBAjvValidatePlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/ajv-validate&apos;</span>;
addRxPlugin(RxDBAjvValidatePlugin);
</code></pre>
<h3 id="validate-z-schema">validate-z-schema</h3>
<p>Both <code>is-my-json-valid</code> and <code>ajv-validate</code> use <code>eval()</code> to perform validation which might not be wanted when <code>&apos;unsafe-eval&apos;</code> is not allowed in Content Security Policies. This one is using <a href="https://github.com/zaggino/z-schema" target="_blank">z-schema</a> as validator which doesn&apos;t use <code>eval</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBValidateZSchemaPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/validate-z-schema&apos;</span>;
addRxPlugin(RxDBValidateZSchemaPlugin);
</code></pre>
<h3 id="no-validate">no-validate</h3>
<p>A validation module that does nothing at handles all data as valid. Use this as an alternative for the normal validator when you can rely on the input of the database.
This is meant for production to reduce the build-size, do not use this in dev-mode.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBNoValidatePlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/no-validate&apos;</span>;
addRxPlugin(RxDBNoValidatePlugin);
</code></pre>
<h2 id="optional-modules">optional modules</h2>
<p>Some modules are optional and only needed if you use their functionality.</p>
<h3 id="dev-mode">dev-mode</h3>
<p>This plugin add many additional check and validations to RxDB and also the extendes error messages.
These checks increase your build size and decrease the performance.
Therefore this plugin should <strong>always</strong> be used in development but <strong>never</strong> in production.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBDevModePlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/dev-mode&apos;</span>;
addRxPlugin(RxDBDevModePlugin);
</code></pre>
<h3 id="query-builder">query-builder</h3>
<p>Adds the <a href="rx-query.html">query-builder</a>-functionality to RxDB which allows you to run queries like <code>myCollection.find().where(&apos;x&apos;).eq(5)</code></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBQueryBuilderPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/query-builder&apos;</span>;
addRxPlugin(RxDBQueryBuilderPlugin);
</code></pre>
<h3 id="migration">migration</h3>
<p>Adds the <a href="data-migration.html">data-migration</a>-functionality to RxDB which allows you to migrate documents when the schema changes.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBMigrationPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/migration&apos;</span>;
addRxPlugin(RxDBMigrationPlugin);
</code></pre>
<h3 id="replication">replication</h3>
<p>Adds the <a href="replication.html">replication</a>-functionality to RxDB which allows you to replicate the database with a CouchDB compliant endpoint.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBReplicationPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/replication&apos;</span>;
addRxPlugin(RxDBReplicationPlugin);
</code></pre>
<h3 id="replication-graphql">replication-graphql</h3>
<p>Allows you to do a replication with a GraphQL endpoint.</p>
<p>See: <a href="replication-graphql.html">Replication with GraphQL</a></p>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> { RxDBReplicationGraphQLPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/replication-graphql&apos;</span>;
addRxPlugin(RxDBReplicationGraphQLPlugin);
</code></pre>
<h3 id="attachments">attachments</h3>
<p>Adds the <a href="rx-attachment.html">attachments</a>-functionality to RxDB.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBAttachmentsPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/attachments&apos;</span>;
addRxPlugin(RxDBAttachmentsPlugin);
</code></pre>
<h3 id="in-memory">in-memory</h3>
<p>Adds the <a href="in-memory.html">in-memory-replication</a> to the collections.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBInMemoryPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/in-memory&apos;</span>;
addRxPlugin(RxDBInMemoryPlugin);
</code></pre>
<h3 id="local-documents">local-documents</h3>
<p>Adds the <a href="rx-local-document.html">local-documents</a> to the collections and databases.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBLocalDocumentsPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/local-documents&apos;</span>;
addRxPlugin(RxDBLocalDocumentsPlugin);
</code></pre>
<h3 id="json-dump">json-dump</h3>
<p>Adds the <a href="rx-database.html#dump">json import/export</a>-functionality to RxDB.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBJsonDumpPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/json-dump&apos;</span>;
addRxPlugin(RxDBJsonDumpPlugin);
</code></pre>
<h3 id="key-compression">key-compression</h3>
<p>The keycompressor-module is needed when you have keyCompression enabled. This is done by default so make sure that you set <a href="rx-schema.html#disablekeycompression">disableKeyCompression</a> to <code>true</code> when you do not have this module.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBKeyCompressionPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/key-compression&apos;</span>;
addRxPlugin(RxDBKeyCompressionPlugin);
</code></pre>
<h3 id="leader-election">leader-election</h3>
<p>The leaderelection-module is needed when want to use the leaderelection.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBLeaderElectionPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/leader-election&apos;</span>;
addRxPlugin(RxDBLeaderElectionPlugin);
</code></pre>
<h3 id="encryption">encryption</h3>
<p>The encryption-module is using <code>crypto-js</code> and is only needed when you create your RxDB-Database with a <a href="rx-database.html#password-optional">password</a>.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBEncryptionPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/encryption&apos;</span>;
addRxPlugin(RxDBEncryptionPlugin);
</code></pre>
<h3 id="update">update</h3>
<p>The update-module is only required when you use <a href="rx-document.html#update">RxDocument.update</a> or <a href="rx-query.html#update">RxQuery.update</a>.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBUpdatePlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/update&apos;</span>;
addRxPlugin(RxDBUpdatePlugin);
</code></pre>
<h3 id="watch-for-changes">watch-for-changes</h3>
<p>When you write data on the internal pouchdb of a collection, by default the changeEvent will not be emitted to RxDB&apos;s changestream.
The watch-for-changes plugin lets you tell the collection to actively watch for changes on the pouchdb-instance whose origin is not RxDB.
This plugin is used internally by the replication-plugin and the in-memory-plugin.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBWatchForChangesPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/watch-for-changes&apos;</span>;
addRxPlugin(RxDBWatchForChangesPlugin);

<span class="hljs-comment">// you can now call this once and then do writes on the pouchdb</span>
myRxCollection.watchForChanges();

<span class="hljs-comment">// now write sth on the pouchdb</span>
myRxCollection.pouch.put({<span class="hljs-comment">/* ... */</span>});
</code></pre>
<h3 id="adapter-check">adapter-check</h3>
<p>This module add the <a href="rx-database.html#checkadapter">checkAdapter</a>-function to RxDB.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { RxDBAdapterCheckPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/adapter-check&apos;</span>;
addRxPlugin(RxDBAdapterCheckPlugin);
</code></pre>
<h3 id="server">server</h3>
<p>Spawns a couchdb-compatible server from a RxDatabase. Use this to replicate data from your electron-node to the browser-window. Or to fast setup a dev-environment.</p>
<p>See: <a href="tutorials/server.html">Tutorial: Using the RxDB Server-Plugin</a></p>
<p><strong>Do never</strong> expose this server to the internet, use a couchdb-instance at production.</p>
<pre><code class="lang-js"><span class="hljs-comment">// run &apos;npm install express-pouchdb&apos; before you use this plugin</span>

<span class="hljs-comment">// This plugin is not included into the default RxDB-build. You have to manually add it.</span>
<span class="hljs-keyword">import</span> { RxDBServerPlugin } <span class="hljs-keyword">from</span> <span class="hljs-string">&apos;rxdb/plugins/server&apos;</span>;
addRxPlugin(RxDBServerPlugin);
</code></pre>
<h2 id="third-party-plugins">Third Party Plugins</h2>
<ul>
<li><a href="https://github.com/rafamel/rxdb-utils" target="_blank">rxdb-utils</a> Additional features for RxDB like models, timestamps, default values, view and more.</li>
<li><a href="https://github.com/cvara/rxdb-hooks" target="_blank">rxdb-hooks</a> A set of hooks to integrate RxDB into react applications. </li>
</ul>
<hr>
<p>If you are new to RxDB, you should continue <a href="plugins.html">here</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="rx-local-document.html" class="navigation navigation-prev " aria-label="Previous page: LocalDocuments">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="plugins.html" class="navigation navigation-next " aria-label="Next page: Creating Plugins">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Custom Build","level":"1.19","depth":1,"next":{"title":"Creating Plugins","level":"1.20","depth":1,"path":"plugins.md","ref":"./plugins.md","articles":[]},"previous":{"title":"LocalDocuments","level":"1.18","depth":1,"path":"rx-local-document.md","ref":"./rx-local-document.md","articles":[]},"dir":"ltr"},"config":{"plugins":["edit-link","github","custom-favicon","-sharing","expandable-chapters","scripts"],"root":".","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/pubkey/rxdb"},"scripts":{"files":["./gitter.js"]},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"favicon":"./files/logo/icon.ico","custom-favicon":{},"edit-link":{"label":"Edit This Page","base":"https://github.com/pubkey/rxdb/tree/master/docs-src"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"RxDB - Documentation","links":{"sidebar":{"Follow @twitter ":"https://twitter.com/rxdbjs","Chat @gitter ":"https://gitter.im/pubkey/rxdb","Star @github ":"https://github.com/pubkey/rxdb","Donate @patreon ":"https://www.patreon.com/rxdb/"}},"gitbook":"3.2.3"},"file":{"path":"custom-build.md","mtime":"2020-07-22T22:17:56.177Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-08-02T14:19:21.945Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-scripts/c6361af027a93a41d58227852f7ae965-gitter.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

